
*analysis of intersectionalism in GSS cumulative


*importing data from master GSS Cumulative file; 
use YEAR SAMPCODE RACDIF1 RACDIF2 RACDIF3 RACDIF4 HELPBLK AFFRMACT FECHLD FEHELP FEPRESCH FEFAM FEHIRE FEJOBAFF DISCAFFW DISCAFFM PRAYER ABNOMORE ABDEFECT ABPOOR ABSINGLE ABANY ABHLTH ABRAPE EQWLTH GETAHEAD HELPPOOR AGE SEX RACE EDUC DEGREE HOMPOP REALINC POLVIEWS PARTYID LIBTEMP CONTEMP SAMPLE OVERSAMP WTSSALL WTSS WTSSNR NATENVIR NATENVIY NATSPAC NATSPACY NATCITY NATCITYY NATFARE NATFAREY ATTEND LIBTEMP CONTEMP REGION REG16 SRCBELT using "C:\Users\ginwi\Downloads\36797-0001-Data.dta"




*RACE
*negative score indicates lack of willingness to recognize racism and environment as factors in African American achievement
*zero equals don't know

*RACDIF1
gen racial1=.
replace racial1=1 if RACDIF1==1
replace racial1=-1 if RACDIF1==2
replace racial1=0 if RACDIF1==8
replace racial1=. if RACDIF1==9
replace racial1=. if RACDIF1==0

*RACDIF2
gen racial2=.
replace racial2=1 if RACDIF2==2
replace racial2=-1 if RACDIF2==1
replace racial2=0 if RACDIF2==8
replace racial2=. if RACDIF2==9
replace racial2=. if RACDIF2==0

*RACDIF3
gen racial3=.
replace racial3=1 if RACDIF3==1
replace racial3=-1 if RACDIF3==2
replace racial3=0 if RACDIF3==8
replace racial3=. if RACDIF3==9
replace racial3=. if RACDIF3==0

*RACDIF4
gen racial4=.
replace racial4=1 if RACDIF4==2
replace racial4=-1 if RACDIF4==1
replace racial4=0 if RACDIF4==8
replace racial4=. if RACDIF4==9
replace racial4=. if RACDIF4==0


*racdif2 not used because vast majority don't answer that there is biological difference

gen racial=(racial1+racial3+racial4)/3



sort YEAR
by YEAR, sort: egen racialmean=mean(racial)
by YEAR, sort: egen racialsd=sd(racial)
gen zracial=(racial-racialmean)/racialsd



************************
*GENDER

*negative score indicates more conservative view of women's role
*zero equals neutral/don't know

*FECHLD
gen gender1=.
replace gender1=1 if FECHLD==1
replace gender1=.5 if FECHLD==2
replace gender1=-.5 if FECHLD==3
replace gender1=-1 if FECHLD==4
replace gender1=0 if FECHLD==8
replace gender1=. if FECHLD==9
replace gender1=. if FECHLD==0

*FEHELP; only goes to 1990s

*gen gender2=.
*replace gender2=1 if FEHELP==4
*replace gender2=.5 if FEHELP==3
*replace gender2=-.5 if FEHELP==2
*replace gender2=-1 if FEHELP==1
*replace gender2=0 if FEHELP==8
*replace gender2=. if FEHELP==9
*replace gender2=. if FEHELP==0

*FEPRESCH
gen gender3=.
replace gender3=1 if FEPRESCH==4
replace gender3=.5 if FEPRESCH==3
replace gender3=-.5 if FEPRESCH==2
replace gender3=-1 if FEPRESCH==1
replace gender3=0 if FEPRESCH==8
replace gender3=. if FEPRESCH==9
replace gender3=. if FEPRESCH==0

*FEFAM
gen gender4=.
replace gender4=1 if FEFAM==4
replace gender4=.5 if FEFAM==3
replace gender4=-.5 if FEFAM==2
replace gender4=-1 if FEFAM==1
replace gender4=0 if FEFAM==8
replace gender4=. if FEFAM==9
replace gender4=. if FEFAM==0


gen gender=(gender1+gender3+gender4)/3

*gender3 and gender4 are a little more evenly split than gender1




sort YEAR
by YEAR, sort: egen gendermean=mean(gender)
by YEAR, sort: egen gendersd=sd(gender)
gen zgender=(gender-gendermean)/gendersd




************************
*RELIG

*PRAYER

*do you suppt S Ct decision banning state-led prayer in schools; yes=1, no=2

gen religion1=.
replace religion1=1 if PRAYER==1
replace religion1=-1 if PRAYER==2
replace religion1=0 if PRAYER==8
replace religion1=. if PRAYER==9
replace religion1=. if PRAYER==0



sort YEAR
by YEAR, sort: egen religion1mean=mean(religion1)
by YEAR, sort: egen religion1sd=sd(religion1)
gen zreligion1=(religion1-religion1mean)/religion1sd


************************
*CLASS

*EQWLTH; positive is support for gov aid to poor; negative is don't support

gen govtpoor=.
replace govtpoor=1 if EQWLTH==1
replace govtpoor=.66 if EQWLTH==2
replace govtpoor=.33 if EQWLTH==3
replace govtpoor=0 if EQWLTH==4
replace govtpoor=-.33 if EQWLTH==5
replace govtpoor=-.66 if EQWLTH==6
replace govtpoor=-1 if EQWLTH==7
replace govtpoor=0 if EQWLTH==8
replace govtpoor=. if EQWLTH==9
replace govtpoor=. if EQWLTH==0

*GETAHEAD

gen lucky=.
replace lucky=1 if GETAHEAD==3
replace lucky=0 if GETAHEAD==2
replace lucky=-1 if GETAHEAD==1
replace lucky=. if GETAHEAD==4
replace lucky=0 if GETAHEAD==8
replace lucky=. if GETAHEAD==9
replace lucky=. if GETAHEAD==.

*HELPPOOR

gen govtpoor2=.
replace govtpoor2=1 if HELPPOOR==1
replace govtpoor2=.5 if HELPPOOR==2
replace govtpoor2=0 if HELPPOOR==3
replace govtpoor2=-.5 if HELPPOOR==4
replace govtpoor2=-1 if HELPPOOR==5
replace govtpoor2=0 if HELPPOOR==8
replace govtpoor2=. if HELPPOOR==9
replace govtpoor2=. if HELPPOOR==0


gen class=(govtpoor+govtpoor2)/2



sort YEAR
by YEAR, sort: egen classmean=mean(class)
by YEAR, sort: egen classsd=sd(class)
gen zclass=(class-classmean)/classsd




************************
*CONTROLS

*age; coded 1 through 8; capped at 80 and over
gen age10=AGE
replace age10=. if AGE==9


*educational attainment: DEGREE
gen lessthanhs=.
replace lessthanhs=1 if DEGREE==0
replace lessthanhs=0 if DEGREE>0 & DEGREE<8

gen hs=.
replace hs=1 if DEGREE==1
replace hs=0 if DEGREE>1 & DEGREE<8
replace hs=0 if DEGREE==0

gen somecollege=.
replace somecollege=1 if DEGREE==2
replace somecollege=0 if DEGREE<2
replace somecollege=0 if DEGREE>4 & DEGREE<8
 
gen college=.
replace college=1 if DEGREE>2 & DEGREE<8
replace college=0 if DEGREE<3

*years of educational attainment

gen educyears=EDUC
replace educyears=. if EDUC>20

gen education=EDUC
replace education=16 if EDUC>16
replace education=9 if EDUC<9
replace education=. if EDUC>20


*gender: SEX
gen male=.
replace male=1 if SEX==1
replace male=0 if SEX==2

*race: RACE
gen white=0
replace white=1 if RACE==1

gen black=0
replace black=1 if RACE==2

gen otherrace=0
replace otherrace=1 if RACE==3

*income (not sure diff bet realinc and coninc)
gen realfamincome=REALINC
replace realfamincome=. if REALINC==0

*hompop (size of household; should divide by square root)
gen housesize=HOMPOP
replace housesize=. if HOMPOP>97

*ideology: POLVIEWS; more positive equals more liberal
gen ideology=.
replace ideology=1 if POLVIEWS==1
replace ideology=.66 if POLVIEWS==2
replace ideology=.33 if POLVIEWS==3
replace ideology=0 if POLVIEWS==4
replace ideology=-.33 if POLVIEWS==5
replace ideology=-.66 if POLVIEWS==6
replace ideology=-1 if POLVIEWS==7

*church attendance: ATTEND; 0 equals never; 8 equals several times a week
gen chatt=ATTEND
replace chatt=. if ATTEND>8

gen religious=0
replace religious=1 if chatt>3

*party id

gen dem=0
replace dem=1 if PARTYID<3
replace dem=. if PARTYID>7
replace dem=. if PARTYID==0

gen rep=0
replace rep=1 if PARTYID>3
replace rep=. if PARTYID>7
replace rep=. if PARTYID==0

gen ind=0
replace ind=1 if PARTYID==3
replace ind=. if PARTYID>7
replace ind=. if PARTYID==0

gen otherparty=0
replace otherparty=1 if PARTYID==4
replace otherparty=. if PARTYID>7
replace otherparty=. if PARTYID==0

*south
gen south=0
replace south=1 if REGION>4 & REGION<8

gen south1=0
replace south1=1 if REG16>4 & REG16<8

*suburban and rural
gen suburb=0
replace suburb=1 if SRCBELT>2 & SRCBELT<5
gen rural=0
replace rural=1 if SRCBELT==6




*************************
*LOOK AT INTERSECTIONALISM; generate intersectionality dummies

* racial gender class and religion (prayer in school only):
*these are only questions asked of same respondents
*sortleft (two more more categories)
*sortleftb (three categories only)

gen racegenrelleft=0
replace racegenrelleft=1 if racial>0 & gender>0 & religion1>0 & class<=0
replace racegenrelleft=. if racial==. 
replace racegenrelleft=. if gender==.
replace racegenrelleft=. if religion1==.
replace racegenrelleft=. if class==.
gen racegenclassleft=0
replace racegenclassleft=1 if racial>0 & gender>0 & religion1<=0 & class>0
replace racegenclassleft=. if racial==. 
replace racegenclassleft=. if gender==.
replace racegenclassleft=. if religion1==.
replace racegenclassleft=. if class==.
gen racerelclassleft=0
replace racerelclassleft=1 if racial>0 & gender<=0 & religion1>0 & class>0
replace racerelclassleft=. if racial==. 
replace racerelclassleft=. if gender==.
replace racerelclassleft=. if religion1==.
replace racerelclassleft=. if class==.
gen genrelclassleft=0
replace genrelclassleft=1 if racial<=0 & gender>0 & religion1>0 & class>0
replace genrelclassleft=. if racial==. 
replace genrelclassleft=. if gender==.
replace genrelclassleft=. if religion1==.
replace genrelclassleft=. if class==.
gen allleft=0
replace allleft=1 if racial>0 & gender>0 & religion1>0 & class>0
replace allleft=. if racial==. 
replace allleft=. if gender==.
replace allleft=. if religion1==.
replace allleft=. if class==.

gen threeleft=0
replace threeleft=1 if racial>0 & gender>0 & religion1>0 & class<=0
replace threeleft=1 if racial>0 & gender>0 & religion1<=0 & class>0
replace threeleft=1 if racial>0 & gender<=0 & religion1>0 & class>0
replace threeleft=1 if racial<=0 & gender>0 & religion1>0 & class>0
replace threeleft=. if racial==. 
replace threeleft=. if gender==.
replace threeleft=. if religion1==.
replace threeleft=. if class==.



gen sortleftb=0
replace sortleftb=1 if racegenrelleft==1
replace sortleftb=1 if racegenclassleft==1
replace sortleftb=1 if racerelclassleft==1
replace sortleftb=1 if genrelclassleft==1
replace sortleftb=1 if allleft==1
replace sortleftb=. if racial==.
replace sortleftb=. if gender==.
replace sortleftb=. if religion1==.
replace sortleftb=. if class==.





gen racegenrelright=0
replace racegenrelright=1 if racial<0 & gender<0 & religion1<0 & class>=0
replace racegenrelright=. if racial==. 
replace racegenrelright=. if gender==.
replace racegenrelright=. if religion1==.
replace racegenrelright=. if class==.
gen racegenclassright=0
replace racegenclassright=1 if racial<0 & gender<0 & religion1>=0 & class<0
replace racegenclassright=. if racial==. 
replace racegenclassright=. if gender==.
replace racegenclassright=. if religion1==.
replace racegenclassright=. if class==.
gen racerelclassright=0
replace racerelclassright=1 if racial<0 & gender>=0 & religion1<0 & class<0
replace racerelclassright=. if racial==. 
replace racerelclassright=. if gender==.
replace racerelclassright=. if religion1==.
replace racerelclassright=. if class==.
gen genrelclassright=0
replace genrelclassright=1 if racial>=0 & gender<0 & religion1<0 & class<0
replace genrelclassright=. if racial==. 
replace genrelclassright=. if gender==.
replace genrelclassright=. if religion1==.
replace genrelclassright=. if class==.
gen allright=0
replace allright=1 if racial<0 & gender<0 & religion1<0 & class<0
replace allright=. if racial==. 
replace allright=. if gender==.
replace allright=. if religion1==.
replace allright=. if class==.

gen threeright=0
replace threeright=1 if racial<0 & gender<0 & religion1<0 & class>=0
replace threeright=1 if racial<0 & gender<0 & religion1>=0 & class<0
replace threeright=1 if racial<0 & gender>=0 & religion1<0 & class<0
replace threeright=1 if racial>=0 & gender<0 & religion1<0 & class<0
replace threeright=. if racial==. 
replace threeright=. if gender==.
replace threeright=. if religion1==.
replace threeright=. if class==.




gen sortrightb=0
replace sortrightb=1 if racegenrelright==1
replace sortrightb=1 if racegenclassright==1
replace sortrightb=1 if racerelclassright==1
replace sortrightb=1 if genrelclassright==1
replace sortrightb=1 if allright==1
replace sortrightb=. if racial==.
replace sortrightb=. if gender==.
replace sortrightb=. if religion1==.
replace sortrightb=. if class==.









***********************

*ANALYSIS

svyset SAMPCODE [pweight=WTSSALL]




*sortleftb and sortrightb are all 4 dimensions, with agreement on 3 or 4 dimensions coded as 1; looking at whether there is intersection on 3 or more
svy: mean sortleftb if YEAR==1988 & white==1
svy: mean sortleftb if YEAR==1990 & white==1
svy: mean sortleftb if YEAR==1994 & white==1
svy: mean sortleftb if YEAR==1996 & white==1
svy: mean sortleftb if YEAR==1998 & white==1
svy: mean sortleftb if YEAR==2000 & white==1
svy: mean sortleftb if YEAR==2002 & white==1
svy: mean sortleftb if YEAR==2004 & white==1
svy: mean sortleftb if YEAR==2006 & white==1
svy: mean sortleftb if YEAR==2008 & white==1
svy: mean sortleftb if YEAR==2010 & white==1
svy: mean sortleftb if YEAR==2012 & white==1
svy: mean sortleftb if YEAR==2014 & white==1
svy: mean sortleftb if YEAR==2016 & white==1

svy: mean sortrightb if YEAR==1988 & white==1
svy: mean sortrightb if YEAR==1990 & white==1
svy: mean sortrightb if YEAR==1994 & white==1
svy: mean sortrightb if YEAR==1996 & white==1
svy: mean sortrightb if YEAR==1998 & white==1
svy: mean sortrightb if YEAR==2000 & white==1
svy: mean sortrightb if YEAR==2002 & white==1
svy: mean sortrightb if YEAR==2004 & white==1
svy: mean sortrightb if YEAR==2006 & white==1
svy: mean sortrightb if YEAR==2008 & white==1
svy: mean sortrightb if YEAR==2010 & white==1
svy: mean sortrightb if YEAR==2012 & white==1
svy: mean sortrightb if YEAR==2014 & white==1
svy: mean sortrightb if YEAR==2016 & white==1



*same analysis but not restricted to whites

svy: mean sortleftb if YEAR==1988 
svy: mean sortleftb if YEAR==1990 
svy: mean sortleftb if YEAR==1994 
svy: mean sortleftb if YEAR==1996 
svy: mean sortleftb if YEAR==1998 
svy: mean sortleftb if YEAR==2000 
svy: mean sortleftb if YEAR==2002 
svy: mean sortleftb if YEAR==2004 
svy: mean sortleftb if YEAR==2006 
svy: mean sortleftb if YEAR==2008 
svy: mean sortleftb if YEAR==2010 
svy: mean sortleftb if YEAR==2012 
svy: mean sortleftb if YEAR==2014 
svy: mean sortleftb if YEAR==2016 

svy: mean sortrightb if YEAR==1988 
svy: mean sortrightb if YEAR==1990 
svy: mean sortrightb if YEAR==1994 
svy: mean sortrightb if YEAR==1996 
svy: mean sortrightb if YEAR==1998 
svy: mean sortrightb if YEAR==2000 
svy: mean sortrightb if YEAR==2002 
svy: mean sortrightb if YEAR==2004 
svy: mean sortrightb if YEAR==2006 
svy: mean sortrightb if YEAR==2008 
svy: mean sortrightb if YEAR==2010 
svy: mean sortrightb if YEAR==2012 
svy: mean sortrightb if YEAR==2014 
svy: mean sortrightb if YEAR==2016

*same analysis, but only nonwhites

svy: mean sortleftb if YEAR==1988 & white==0
svy: mean sortleftb if YEAR==1990 & white==0 
svy: mean sortleftb if YEAR==1994 & white==0
svy: mean sortleftb if YEAR==1996 & white==0
svy: mean sortleftb if YEAR==1998 & white==0
svy: mean sortleftb if YEAR==2000 & white==0
svy: mean sortleftb if YEAR==2002 & white==0
svy: mean sortleftb if YEAR==2004 & white==0
svy: mean sortleftb if YEAR==2006 & white==0
svy: mean sortleftb if YEAR==2008 & white==0
svy: mean sortleftb if YEAR==2010 & white==0
svy: mean sortleftb if YEAR==2012 & white==0
svy: mean sortleftb if YEAR==2014 & white==0
svy: mean sortleftb if YEAR==2016 & white==0

svy: mean sortrightb if YEAR==1988 & white==0
svy: mean sortrightb if YEAR==1990 & white==0
svy: mean sortrightb if YEAR==1994 & white==0
svy: mean sortrightb if YEAR==1996 & white==0
svy: mean sortrightb if YEAR==1998 & white==0
svy: mean sortrightb if YEAR==2000 & white==0
svy: mean sortrightb if YEAR==2002 & white==0
svy: mean sortrightb if YEAR==2004 & white==0
svy: mean sortrightb if YEAR==2006 & white==0
svy: mean sortrightb if YEAR==2008 & white==0
svy: mean sortrightb if YEAR==2010 & white==0
svy: mean sortrightb if YEAR==2012 & white==0
svy: mean sortrightb if YEAR==2014 & white==0
svy: mean sortrightb if YEAR==2016 & white==0


svy: mean sortleftb if YEAR==1988 & black==1
svy: mean sortleftb if YEAR==1990 & black==1 
svy: mean sortleftb if YEAR==1994 & black==1
svy: mean sortleftb if YEAR==1996 & black==1
svy: mean sortleftb if YEAR==1998 & black==1
svy: mean sortleftb if YEAR==2000 & black==1
svy: mean sortleftb if YEAR==2002 & black==1
svy: mean sortleftb if YEAR==2004 & black==1
svy: mean sortleftb if YEAR==2006 & black==1
svy: mean sortleftb if YEAR==2008 & black==1
svy: mean sortleftb if YEAR==2010 & black==1
svy: mean sortleftb if YEAR==2012 & black==1
svy: mean sortleftb if YEAR==2014 & black==1
svy: mean sortleftb if YEAR==2016 & black==1



*generating pooled comparison of years 1988-2006, and 2006 to 2016...

gen obamayears=0
replace obamayears=1 if YEAR>2006
replace obamayears=. if YEAR<1988



svy: mean sortleftb if obamayears==0
svy: mean sortrightb if obamayears==0
svy: mean sortleftb if obamayears==0 & white==1
svy: mean sortrightb if obamayears==0 & white==1

svy: mean sortleftb if obamayears==1
svy: mean sortrightb if obamayears==1
svy: mean sortleftb if obamayears==1 & white==1
svy: mean sortrightb if obamayears==1 & white==1

svy: mean sortleftb if obamayears==0 & black==1
svy: mean sortrightb if obamayears==0 & black==1
svy: mean sortleftb if obamayears==1 & black==1
svy: mean sortrightb if obamayears==1 & black==1

svy: mean sortleftb if obamayears==0 & religious==1
svy: mean sortrightb if obamayears==0 & religious==1
svy: mean sortleftb if obamayears==1 & religious==1
svy: mean sortrightb if obamayears==1 & religious==1



